#include "widget.h"
#include "ui_widget.h"

#include <QDebug>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    button= new QPushButton(this);
    button->setEnabled(false);
    button->setText("按钮");
    QPushButton* button2 = new QPushButton(this);
    button2->setEnabled(true);
    button2->setText("按钮2");
    button2->move(300,400);
    connect(button, &QPushButton::clicked, this, &Widget::sout);
    connect(button2, &QPushButton::clicked, this, &Widget::sout2);
}

Widget::~Widget()
{
    delete ui;
}
void Widget::sout(){
    qDebug() << "钩子";
}
void Widget::sout2(){
    if(button->isEnabled() == false)
        button->setEnabled(true);
    else
        button->setEnabled(false);
}
